package com.test02_程序基础应用;

/**
 * 打印出100~1000范围内的所有 “水仙花数”
 * 所谓“水仙花数”是指一个三位数，其各位数字立方和等于该数本身。
 */
public class YootkDemo_02 {

    public static void main(String[] args) {
        System.out.print("水仙花数字：");
        for (int x = 100; x < 1000; x++) {
            int h = x / 100;
            int t = (x - h * 100) / 10;
            int u = (x - h * 100 - t * 10);
            if (x == (h * h * h + t * t * t + u * u * u)) {
                System.out.print(x + "、");
            }
        }
    }
}
